package stu.day19_day24.day20;

public class LeetCode860 {

    public boolean lemonadeChange(int[] bills) {
        int five = 0;
        int ten = 0;

        for(int rmb:bills){
            if(rmb == 5){
                five += 1;
            }else if(rmb == 10){
                if(five<=0){
                    return false;
                }else {
                    five -= 1;
                    ten += 1;
                }
            }else{
                if(ten <= 0){
                   if(five < 3){
                       return false;
                   }else {
                       five -= 3;
                   }
                }else {
                    ten -= 1;
                    if(five<=0){
                        return false;
                    }else {
                        five -= 1;
                    }
                }
            }
        }






        return true;
    }
}
